package com.fsnbigdata.service.impl;
import com.fsnbigdata.service.api.OrganismVideoService;
import org.springframework.roo.addon.layers.service.annotations.RooServiceImpl;
import com.fsnbigdata.domain.Organism;
import com.fsnbigdata.domain.OrganismVideo;
import com.fsnbigdata.repository.OrganismVideoRepository;
import io.springlets.data.domain.GlobalSearch;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * = OrganismVideoServiceImpl
 *
 * TODO Auto-generated class documentation
 *
 */
@RooServiceImpl(service = OrganismVideoService.class)
@Service
@Transactional(readOnly = true)
public class OrganismVideoServiceImpl implements OrganismVideoService {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    private OrganismVideoRepository organismVideoRepository;

    /**
     * TODO Auto-generated constructor documentation
     *
     * @param organismVideoRepository
     */
    @Autowired
    public OrganismVideoServiceImpl(OrganismVideoRepository organismVideoRepository) {
        setOrganismVideoRepository(organismVideoRepository);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return OrganismVideoRepository
     */
    public OrganismVideoRepository getOrganismVideoRepository() {
        return organismVideoRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organismVideoRepository
     */
    public void setOrganismVideoRepository(OrganismVideoRepository organismVideoRepository) {
        this.organismVideoRepository = organismVideoRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param entity
     * @return OrganismVideo
     */
    @Transactional
    public OrganismVideo save(OrganismVideo entity) {
        return getOrganismVideoRepository().save(entity);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return OrganismVideo
     */
    public OrganismVideo findOne(Long id) {
        return getOrganismVideoRepository().findOne(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return OrganismVideo
     */
    public OrganismVideo findOneForUpdate(Long id) {
        return getOrganismVideoRepository().findOneDetached(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @return List
     */
    public List<OrganismVideo> findAll(Iterable<Long> ids) {
        return getOrganismVideoRepository().findAll(ids);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organism
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public Page<OrganismVideo> findByOrganism(Organism organism, GlobalSearch globalSearch, Pageable pageable) {
        return getOrganismVideoRepository().findByOrganism(organism, globalSearch, pageable);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organism
     * @return Long
     */
    public long countByOrganism(Organism organism) {
        return getOrganismVideoRepository().countByOrganism(organism);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<OrganismVideo> getEntityType() {
        return OrganismVideo.class;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<Long> getIdType() {
        return Long.class;
    }
}
